package com.tedu.bill.demo4;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * Author：毕龙
 * Date: 2024/5/28 9:24
 */
public class TestFile8 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        FileInputStream fis = null;
        ObjectInputStream ois = null;
        try {
            //创建字节流对象
            fis = new FileInputStream("day14/src/object.txt");
            //创建对象输入流
            ois = new ObjectInputStream(fis);

            //获取对象
            Object o = null;
            while ((o = ois.readObject())!=null){
                User user = (User) o;

                System.out.println(user);
            }
        } catch (IOException e) {

        } catch (ClassNotFoundException e) {

        }


        //关闭流
        ois.close();
        fis.close();


    }
}
